std::complex
From Cppreference
| C++ Standard Library | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Numerics library | |||||||||||||||||||||
| |||||||||||||||||||||
| Complex numbers | |||||||||||||||||||||
| Template:cpp/numeric/complex/sidebar content | |||||||||||||||||||||
| Defined in header <complex>
| ||
| template<class T>
class complex; //not defined | (1) | |
| template<> class complex<float>;
| (2) | |
| template<> class complex<double>;
| (3) | |
| template<> class complex<long double>;
| (4) | |
The specializations std::complex<float>, std::complex<double>, and std::complex<long double> are literal types for representing and manipulating complex number. The effect of instantiating the template complex for any other type is unspecified.
[edit] Member types
| Member type | Definition |
| value_type | T |
[edit] Member functions
| constructs a complex number (public member function) | |
| gets/sets real part of the complex number (public member function) | |
| gets/sets imaginary part of the complex number (public member function) | |
| replaces the complex number with another (public member function) | |
| compound assignment of two complex numbers or a complex and a scalar (public member function) | |
[edit] Non-member functions
| applies unary operators to complex numbers (function template) | |
| performs complex number arithmetics on two complex values or a complex and a scalar (function template) | |
| compares two complex numbers or a complex and a scalar (function template) | |
| serializes and deserializes a complex number (function template) | |
| returns the real component (function template) | |
| returns the imaginary component (function template) | |
| returns the magnitude (function template) | |
| returns the phase angle (function template) | |
| returns the squared magnitude (function template) | |
| returns the complex conjugate (function template) | |
| returns the projection onto the Riemann sphere (function template) | |
| constructs a complex number from magnitude and phase angle (function template) | |
| complex number trigonometric functions (function template) | |
| complex base e exponential (function template) | |
| complex natural logarithm with the branch cuts along the negative real axis (function template) | |
| complex common logarithm with the branch cuts along the negative real axis (function template) | |
| complex power, one or both arguments may be a complex number (function template) | |
| complex square root in the range of the right half-plane (function template) | |